package intefaceBased;

import util.NumberNotFoundException;

/**
 * Created with IntelliJ IDEA.
 * User: Gauss
 * Date: 22.10.13
 * Time: 23:43
 * To change this template use File | Settings | File Templates.
 */
public class OrdinaryPascalTriangle implements AbstractPascalTriangle {
    @Override
    public int calcTriangle(int column, int row) throws NumberNotFoundException {
        if (column>row || row<0 || column<0) throw new NumberNotFoundException();
        if (column==0) return 1;
        if (column==row) return 1;
        return calcTriangle(column, row-1)+calcTriangle(column-1, row-1);
    }
}
